package com.gzy.mylog.repository;

import com.gzy.mylog.model.Log;
import com.gzy.mylog.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserRepository extends JpaRepository<User,Long> {
    // select * from user where username = ?
    User findUserByUsername(String userName);



    @Query(value="select * from user  order by id Asc limit ?,?",nativeQuery=true)
    List<User> findAllWithPage_Asc(Integer offset, Integer size);

    @Query(value="select * from user  order by id Desc limit ?,?",nativeQuery=true)
    List<User> findAllWithPage_Desc(Integer offset, Integer size);
}
